﻿/*
 * Authors:    Kęstutis Džiautas
 *             Edmundas Matusevičius
 * University: VU, MIF, SE, 4 course
 * Date:       2010-12-18
 * Version:    1.0
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SemAnalyzer
{
    class KD_TempClass
    {
        /// <summary>
        /// Dummy for now!!!!
        /// </summary>
        public string ScanNext()
        {
            return "";
        }
        /// <summary>
        /// DUMMY FOR NOW!!!
        /// </summary>
        /// <param name="methodname"> Name of the method in which the error happend</param>
        public void Error(string methodname)
        {
            Console.WriteLine(methodname);
            Console.ReadKey();
            Environment.Exit(0);
        }

        /// <summary>
        /// First Procedure for Start
        /// </summary>
        public string Start(string sentence)
        {
            string temp;
            nextLexem = "";
            temp = Decls(sentence);
            nextLexem = ScanNext();
            if (nextLexem.Equals("EOF") && temp != null)
            {
                return sentence;
            }
            else
            {
                Error(System.Reflection.MethodInfo.GetCurrentMethod().Name);
                return null;
            }
        }
        public string Decls(string sentence)
        {
            sentence = Decl(sentence);
            if (sentence != null)
            {
                sentence = DeclsTail(sentence);
                if (sentence != null)
                {
                    return sentence;
                }
            }
            return null;
        }
        public string Decl(string sentence)
        {
            return null;
        }
        public string DeclsTail(string sentence)
        {
            nextLexem = ScanNext();
            return null;
        }
        public void FuncDeclHead()
        {
            FuncId();
            nextLexem = ScanNext();
            if (!nextLexem.Equals("("))
            {
                Error(System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
        }

        public void FuncDeclEnd()
        {

        }
        public void ConstDecl()
        {

        }
        public void ImportDecl()
        {
            if (nextLexem.Equals("import"))
            {
                //StringDef();
                if (nextLexem.Equals(";"))
                {

                }
                else
                {
                    Error(System.Reflection.MethodInfo.GetCurrentMethod().Name);
                }
            }
            else
            {
                Error(System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
        }
        public void EnumDecl()
        {

        }
        public void StructDecl()
        {

        }
        public void FuncDeclBracketsHead()
        {
            if (!nextLexem.Equals(")"))
            {
                Error(System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
        }
        public void FuncDeclBracketsEnd()
        {
            if (nextLexem.Equals(';'))
            {
                //insert into tree (?)
            }
            else
            {
                //Block();
            }
        }
        public void FuncDeclParamsHead()
        {
            Params();
            nextLexem = ScanNext();
            if (nextLexem.Equals(")"))
            {

            }
            else
            {
                Error(System.Reflection.MethodInfo.GetCurrentMethod().Name);
            }
        }
        public void FuncDeclParamsEnd()
        {
            if (nextLexem.Equals(';'))
            {
                //insert into tree (?)
            }
            else
            {
                //Block();
            }
        }
        public void Params()
        {
            Param();
            ParamsTail();
        }
        public void ParamsTail()
        {
            if (nextLexem.Equals(","))
            {
                Param();
                ParamsTail();
            }
        }
        public void Param()
        {
            ParamHead();
            ParamEnd();
        }
        public void ParamHead()
        {
            //Type();
        }
        public void ParamEnd()
        {
            ParamIdHead();
            ParamIdEnd();
            if (nextLexem.Equals("[]"))
            {
                //Inserts to tree
            }
        }
        public void ParamIdHead()
        {
            //Id();
        }
        public void ParamIdEnd()
        {
            if (nextLexem.Equals("[]"))
            {
                //Insert
            }
        }
        public void FuncId()
        {
            FuncIdHead();
            FuncIdEnd();
        }
        public void FuncIdHead()
        {
            //FuncType();
        }
        public void FuncIdEnd()
        {
            if (nextLexem.Equals("[]"))
            {
                //Id();
                //insert?
            }
            //Id();         
        }
        public void ConstVal()
        {

        }
        public void VarDecl()
        {

        }
        public void VarDeclHead()
        {

        }
        public void VarDeclEnd()
        {

        }
        public void Var()
        {

        }
        public void VarHead()
        {

        }
        public void VarEnd()
        {

        }
        public void Stm()
        {

        }
        public void StmHead()
        {

        }
        public void StmEnd()
        {

        }
        public void Arg()
        {

        }
        public void CaseStms()
        {

        }
        public void CaseVal()
        {

        }
        public void Block()
        {

        }
        public void StmList()
        {

        }
        public void StmListTail()
        {

        }





        string nextLexem;
    }
}
